package cn.webrx;


import java.util.Calendar;

public class Switch1 {
    public static void main(String[] args) {
        //学习switch语句 switch case break default 关键字

        var c = Calendar.getInstance();

        c.add(Calendar.DATE, -4);

        System.out.printf("%tF %<tT%n", c);

        //1 - 7
        int k = c.get(Calendar.DAY_OF_WEEK);

        //if(){} else if(){}else if(){}else{}
        switch (k) {
            case 1:
                System.out.println("星期日");
                break;
            case 2:
                System.out.println("星期一");
                break;
            case 3:
                System.out.println("星期二");
                break;
            case 4:
                System.out.println("星期三");
                break;
            case 5:
                System.out.println("星期四");
                break;
            case 6:
                System.out.println("星期五");
                break;
            default:
                System.out.println("星期六");
                break;
        }
    }
}
